using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using Rotempco.Core.Web.CRUD.Objects;
using Rotempco.Core.Web.CRUD.Interfaces;

namespace Rotempco.Core.Web.CRUD.ACRUD
{
    public abstract class ACRUDDefault<TDomainObject> : AAdminMaster where TDomainObject : class, new()
    {
        protected override void OnLoad(EventArgs e)
        {
            if (!IsPostBack)
            {
                PageListContainer pageListContainer = GetPageListContainer();
                (this.Master as ICRUDDefault).SetDefaultPageContainer(pageListContainer);
                if (pageListContainer.HideAddNewButton)
                    (this.Master as ICRUDDefault).HideNewButton();
            }
            base.OnLoad(e);
        }

        public abstract PageListContainer GetPageListContainer();
    }
}